#ifndef __UFCS_DRIVER_H__
#define __UFCS_DRIVER_H__

#include "main.h"

#define UFCS_CONTROL_CMD_PING 0x00
#define UFCS_CONTROL_CMD_ACK 0x01
#define UFCS_CONTROL_CMD_NCK 0x02
#define UFCS_CONTROL_CMD_ACCEPT 0x03
#define UFCS_CONTROL_CMD_SOFT_RESET 0x04
#define UFCS_CONTROL_CMD_POWER_READY 0x05
#define UFCS_CONTROL_CMD_GET_OUTPUT_CAP 0x06
#define UFCS_CONTROL_CMD_GET_SOURCE_INFO 0x07
#define UFCS_CONTROL_CMD_GET_SINK_INFO 0x08
#define UFCS_CONTROL_CMD_GET_CABLE_INFO 0x09
#define UFCS_CONTROL_CMD_GET_DEVICE_INFO 0x0A
#define UFCS_CONTROL_CMD_GET_ERROR_INFO 0x0B
#define UFCS_CONTROL_CMD_DETECT_CABLE_INFO 0x0C
#define UFCS_CONTROL_CMD_START_CABLE_DETECT 0x0D
#define UFCS_CONTROL_CMD_END_CABLE_DETECT 0x0E
#define UFCS_CONTROL_CMD_EXIT_UFCS_MODE 0x0F

#define UFCS_DATA_CMD_OUTPUT_CAP 0x01
#define UFCS_DATA_CMD_REQUEST 0x02
#define UFCS_DATA_CMD_SOURCE_INFO 0x03
#define UFCS_DATA_CMD_SINK_INFO 0x04
#define UFCS_DATA_CMD_CABLE_INFO 0x05
#define UFCS_DATA_CMD_DEVICE_INFO 0x06
#define UFCS_DATA_CMD_ERROR_INFO 0x07
#define UFCS_DATA_CMD_CONFIG_WTD 0x08
#define UFCS_DATA_CMD_REFUSE 0x09
#define UFCS_DATA_CMD_VERIFY_REQUEST 0x0A
#define UFCS_DATA_CMD_VERIFY_RESPONSE 0x0B
#define UFCS_DATA_CMD_POWER_CHANGE 0x0C
#define UFCS_DATA_CMD_TEST_REQUEST 0xFF

#define UFCS_tACKReceive	10
#define UFCS_tACKtransmit	100
#define UFCS_tRetry	500
#define UFCS_tSenderResponse	50
#define UFCS_tReceiverResponse	40
#define UFCS_tPowerSupply	550
#define UFCS_tCableInfoResponse	1200
#define UFCS_tRestartTrans	1100
#define UFCS_tCableTrans 	1000
#define UFCS_tMsgTransDelay2

int UFCS_Shake_Hand(void);
int UFCS_Get_Output_Cap(uint8_t* data);
int UFCS_Request(uint8_t num, uint16_t Volt, uint16_t Curr);
int Get_Source_Info(uint8_t *data);
int UFCS_Exit(void);

int UFCS_Set_Vol(uint16_t volt);
#endif
